home *** CD-ROM | disk | FTP | other *** search
- /*
- ** Project dialog example
- ** Module Buttons.c
- ** Author Bernie Wieser ©1991
- ** Date 10/26/91
- **
- ** Purpose
- ** Routines to handle dialog buttons.
- **
- */
- #include "Buttons.h"
-
- short PressButton( /* fake a button press */
- DialogPtr dp, /* button's dlog */
- short item, /* the button id */
- long delay /* delay down */
- ) /* return failure if button inactive */
- {
- short type;
- Handle object;
- Rect rect;
-
- GetDItem(dp, item, &type, &object, &rect);
- if(type&itemDisable) return(-1);
- HiliteControl(object, TRUE);
- Delay(delay, &delay);
- HiliteControl(object, FALSE);
- return(0);
- }
-
- short DefaultButton( /* highlight the default button */
- DialogPtr dp, /* the button's dialog */
- short item /* the button's id, usually 1 */
- )
- {
- Rect r;
- Handle h;
- short type;
-
- GetDItem(dp, item, &type, &h, &r);
- if(type&itemDisable) return(-1);
- PenSize(3,3);
- InsetRect(&r,-4,-4);
- FrameRoundRect(&r,16,16);
- return(0);
- }